Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DerivedProjectedCRS: deal with lack of explicit CS in BASEPROJCRS in WKT #4124

Merged
merged 3 commits into from
May 7, 2024

Conversation

rouault
Copy link
Member

@rouault rouault commented Apr 23, 2024

  • DerivedProjectedCRS WKT import: workaround lack of explicit CS in BASEPROJCRS

    Current WKT2 grammar doesn't allow an explicit CS (Coordinate System) in the BASEPROJCRS of
    a DERIVEDPROJCRS. This leads to ambiguities when instanciating the
    BASEPROJCRS. Cf Incorrect unit conversion on affine transformation gdal#9732 (comment)
    for a longer analysis

    When importing such a DerivedProjectedCRS, we apply the following
    strategy to try to reconstruct the CS of the baseProjCRS (if not present.
    cf later bullet point where we mention adding it on export side):

    • if the baseProjCRS has an ID[], do a datebase lookup for this object,
      and if found, use its CS
    • otherwise, do a database lookup from the name of the baseProjCRS, and
      if found, use its CS
    • otherwise, browse through the PARAMETERs of the CONVERSION of the
      BASEPROJCRS, and if there is at least one such PARAMETER that has a
      linear unit, and if all PARAMETERs with a linear unit have the same
      one, then use it to reconstruct a Easting/Northing CartesianCS.
    • otherwise, fallback to current behaviour, that is return a
      Easting/Northing CartesianCS with metre unit.

    Fixes Incorrect unit conversion on affine transformation gdal#9732

  • WKT2 grammar: allow a DERIVEDPROJCRS.BASEPROJCRS.CS node

  • DerivedProjetedCRS WKT export: emit a BASEPROJCRS.CS node in situations where there's ambiguity

rouault added 3 commits April 23, 2024 17:53
…EPROJCRS

Current WKT2 grammar doesn't allow an explicit CS (Coordinate System) in the BASEPROJCRS of
a DERIVEDPROJCRS. This leads to ambiguities when instanciating the
BASEPROJCRS. Cf OSGeo/gdal#9732 (comment)
for a longer analysis

When importing such a DerivedProjectedCRS, we apply the following
strategy to try to reconstrut the CS of the baseProjCRS:
- if the baseProjCRS has an ID[], do a datebase lookup for this object,
  and if found, use its CS
- otherwise, do a database lookup from the name of the baseProjCRS, and
  if found, use its CS
- otherwise, browse through the PARAMETERs of the CONVERSION of the
  BASEPROJCRS, and if there is at least one such PARAMETER that has a
  linear unit, and if all PARAMETERs with a linear unit have the same
  one, then use it to reconstruct a Easting/Northing CartesianCS.
- otherwise, fallback to current behaviour, that is return a
  Easting/Northing CartesianCS with metre unit.

Fixes OSGeo/gdal#9732
Current WKT grammar (as of WKT2 18-010r11) does not allow a
BASEPROJCRS.CS node, but there are situations where this is
ambiguous and we want to allow one.
Cf OSGeo/gdal#9732 (comment)
rouault added a commit to rouault/gdal that referenced this pull request Apr 23, 2024
We export CRS objects to PROJJSON rather than WKT2:2019 because PROJJSON
is a bit more verbose, which helps in situations like
OSGeo#9732 /
OSGeo/PROJ#4124 where we want to export
a DerivedProjectedCRS whose base ProjectedCRS has non-metre axis.

Fixes OSGeo#9732
rouault added a commit to rouault/gdal that referenced this pull request Apr 23, 2024
We export CRS objects to PROJJSON rather than WKT2:2019 because PROJJSON
is a bit more verbose, which helps in situations like
OSGeo#9732 /
OSGeo/PROJ#4124 where we want to export
a DerivedProjectedCRS whose base ProjectedCRS has non-metre axis.

Fixes OSGeo#9732
rouault added a commit to rouault/gdal that referenced this pull request Apr 23, 2024
We export CRS objects to PROJJSON rather than WKT2:2019 because PROJJSON
is a bit more verbose, which helps in situations like
OSGeo#9732 /
OSGeo/PROJ#4124 where we want to export
a DerivedProjectedCRS whose base ProjectedCRS has non-metre axis.

Fixes OSGeo#9732
rouault added a commit to OSGeo/gdal that referenced this pull request Apr 24, 2024
We export CRS objects to PROJJSON rather than WKT2:2019 because PROJJSON
is a bit more verbose, which helps in situations like
#9732 /
OSGeo/PROJ#4124 where we want to export
a DerivedProjectedCRS whose base ProjectedCRS has non-metre axis.

Fixes #9732
@rouault
Copy link
Member Author

rouault commented May 7, 2024

The discussion with the OGC CRS SWG about this issue are unconclusive for now, so let's merge this.

@rouault rouault merged commit a715623 into OSGeo:master May 7, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect unit conversion on affine transformation
1 participant